package com.zqwh.xtool.converter;

import com.zqwh.xtool.domain.StockVO;
import com.zqwh.xtool.greendao.db.Stock;

import java.util.ArrayList;

public class Stock2StockVOConverter {
    public static StockVO convert(Stock stock){
        StockVO stockVO = new StockVO();
        stockVO.setDevId(stock.getDevId());
        stockVO.setEpc(stock.getEpc());
        stockVO.setDescription(stock.getToolDesc());
        stockVO.setName(stock.getToolName());
        stockVO.setHasLent(stock.getHasLent());
        stockVO.setHasFound(false);
        stockVO.setHasRFID(stock.getHasRFID());
        stockVO.setToolId(stock.getToolId());
        stockVO.setSpec(stock.getToolSpec());
        stockVO.setStockId(stock.getStockId());
        return stockVO;
    }

    public static ArrayList<StockVO> convert(ArrayList<Stock> stockList){
        ArrayList<StockVO> stockVOList = new ArrayList<>();
        for (Stock stock:stockList){
            stockVOList.add(convert(stock));
        }
        return stockVOList;
    }
}
